package com.zys.exercise;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Consumer;

public class text1 {
    public static void main(String[] args) {
        Collection<String> list = new ArrayList<>() ;
        list.add("a");
        list.add("b");
        list.add("c");


//        System.out.println(list);
////        list.clear();
////        System.out.println(list);
//        list.remove("a");
//        System.out.println(list);
//        list.contains("b");
//        list.isEmpty();
//        list.remove("b");
//        System.out.println(list);
//
//        Iterator<String> it = list.iterator();
//        System.out.println(it.hasNext());
//        System.out.println(it.next());
//        System.out.println(it.hasNext());
////        System.out.println(it.next());
//        Iterator<String> it2 = list.iterator();
//        while(it2.hasNext()){
//            String str = new String();
//            str = it2.next();
//            if(str.equals("c"))
//            it2.remove();
//        }
//        System.out.println(list);
        list.add("a");
        list.add("b");
        list.add("c");
        for(String s :list){
            System.out.print(s+" ");
        }
        System.out.println();
        list.forEach(new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.print(s+" ");
            }
        });
        System.out.println();
        list.forEach((String s)->{
            System.out.print(s+" ");
        });


    }

}
